package myta.bean;

import myta.model.DataTable;
import myta.service.Command;
import myta.service.SQLexec;

public class DataDetail {
	private DataTable dataAbsensi;
	private DataTable dataNilai;
	
	public DataDetail() {
		try {
			String sql = "select ad.idabsen, ad.nis, s.nama, case when ad.absensi = 0 then false else true end as absensi from absen_detail ad ";
			sql += "inner join siswa s on ad.nis = s.nis ";
			sql += "where ad.idabsen = ? ";
			Command command = SQLexec.makeCommand(sql);
			command.setObject(1, "kampret");
			dataAbsensi = command.executeQuery();
			
			sql = "select nd.idnilai, nd.nis, s.nama, nd.nilai from nilai_detail nd ";
			sql += "inner join siswa s on nd.nis = s.nis ";
			sql += "where nd.idnilai = ?";
			command = SQLexec.makeCommand(sql);
			command.setObject(1, "kampret");
			dataNilai = command.executeQuery();
		} catch (Exception e) {
			System.out.println(e);
		}
	}

	public DataTable getDataAbsensi() {
		return dataAbsensi;
	}

	public void setDataAbsensi(DataTable dataAbsensi) {
		this.dataAbsensi = dataAbsensi;
	}

	public DataTable getDataNilai() {
		return dataNilai;
	}

	public void setDataNilai(DataTable dataNilai) {
		this.dataNilai = dataNilai;
	}
}
